package com.itheima.controller;

import com.itheima.domain.insertGame;
import com.itheima.service.aiwanservice;
import com.itheima.service.impl.youxiservie;
import com.itheima.vo.Result;
import com.itheima.vo.youxiVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/game")
public class Controller {
    @Autowired
    private aiwanservice aiwanservice;
    //接受参数
    @GetMapping
    public Result<List<youxiVO>> game(){
        //2. 调用service完成业务逻辑处理
        List<youxiVO> game =aiwanservice.game();
        return Result.ok(game);


    }
    private  insertGame insertGame;
      @PostMapping
      public Result lrxx(@RequestBody insertGame intg){
            aiwanservice.lrxx(intg);
            return Result.ok();
      }
      @PutMapping()
    public  Result xiugai( @RequestBody insertGame intg1) {
          aiwanservice.xiugai(intg1);
          return Result.ok();
      }
       // 根据ID删除游戏信息
    @DeleteMapping("{id}")
    public Result chanchu(@PathVariable Integer id){
        aiwanservice.chanchu(id);
        return Result.ok();
    }
    }

